-
Notifications
You must be signed in to change notification settings - Fork 802
[SYCL] Reset in-mem cache in early shutdown #20948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses a segmentation fault that occurs when kernel libraries deregister with the SYCL runtime in parallel after early shutdown. The fix ensures that the in-memory cache (containing device images, kernels, and programs) is cleared before releasing SYCL contexts during early shutdown, preventing attempts to release kernel/program resources after their associated contexts have already been released.
Key Changes:
- Clear in-memory cache during early shutdown before releasing default contexts
- Replace exception throwing with early return when cache entries aren't found (post-shutdown scenario)
- Update test expectations to reflect the new order of resource release operations
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sycl/source/detail/global_handler.cpp | Adds logic to reset in-memory cache for all platform default contexts before releasing them during early shutdown |
| sycl/source/detail/kernel_program_cache.hpp | Changes cache clearing to use .clear() instead of reconstructing objects, and replaces exception with early return for missing cache entries |
| sycl/test-e2e/Scheduler/ReleaseResourcesTest.cpp | Updates test expectations to reflect that programs/kernels are now released before contexts |
| sycl/test-e2e/KernelAndProgram/disable-caching.cpp | Updates test expectations to reflect new release ordering during early shutdown |
| sycl/test-e2e/Basic/queue/release.cpp | Updates test expectations to reflect that kernels/programs are now released before contexts |
|
@intel/llvm-gatekeepers please consider merging |
Problem
When a kernel library deregisters with the SYCL RT, we clear the associated device images and kernel/program entries from in-memory cache. When a library deregisters with the SYCL RT parallelly after early shutdown, releasing kernel/programs might segfault because we have already released all the context (urContextRelease) during early shutdown.
Solution
Clear up in-memory cache in early shutdown before releasing SYCL contexts.